//the quiet melody shines the sky from now...
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define endl '\n'
int n,a[100009],cnt[100009],ans;
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i],cnt[a[i]]++;
    for(int i=1,cur=0;i<=100000;i++){
        ans+=min(cur,cnt[i]);
        cur=max(cur,cnt[i]);
    }
    cout<<n-ans<<endl;
    return 0;
}